package com.aop.aspect;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * 关注点：重复代码
 * 
 * 
 * 用动态代理  织入
 * 
 * 
 * 
 * @author My
 *
 */

@Component
@Aspect
public class TransactionAspect {
	
	@Pointcut("execution(* com.aop.aspect.*.*(..))")
	public void printTitle(){}
	
	@Before(value="printTitle()")
	public void  TransactionAspect(){
		System.out.println("手写的切面开启事务");
	}
	
	@After(value="printTitle()")
	public void commit(){
		System.out.println("手写的切面提交事务");
		
	}
	
	
	

}
